﻿//using System;
//using System.Linq;
//using System.Web.Mvc;
//using MiniWeb.Core.Entities;
//using MiniWeb.Core.Enums;
//using MiniWeb.Task;
//using MiniWeb.Web.Controllers.Admin.VoucherHistoryManager.ViewModels;
//using WFramework.Extensions;
//using WFramework.Mappers;
//using WFramework.MvcPager;

//namespace MiniWeb.Web.Controllers.Admin.VoucherHistoryManager
//{
	
//    public  class VoucherHistoryManagerController:BaseController
//    {
//         private readonly VoucherHistoryTask _voucherhistoryTask = new VoucherHistoryTask();
	 
//         public ActionResult List(string code,string nickname,int? sid,int pageIndex=1, int pageSize=20)
//        {
//            var pagedList = _voucherhistoryTask.GetPagedList(code,nickname,sid,pageIndex, pageSize);

//             ViewData["voucherstatlist"] = VoucherStateEnum.充值成功.ToSelectListForAll();

//            var model = new PagedList<VoucherHistory>(pagedList.ToList(), pageIndex, pageSize, pagedList.TotalItemCount);

//            return View(model);
//        }
        
        
//       public ActionResult Save(int? id)
//        {
           

//            var model = new SaveVoucherHistory();

//            if(id != null)
//            {
//                var item = _voucherhistoryTask.GetById((int) id);
//                if (item == null)
//                    return AlertMsg("参数错误", HttpContext.Request.UrlReferrer.PathAndQuery);

//                model = EntityMapper.Map<VoucherHistory, SaveVoucherHistory>(item);
//            }
//            return View(model);
//        }

//        [HttpPost]
//        public ActionResult Save(SaveVoucherHistory savemodel)
//        {
           
//                       if(ModelState.IsValid)
//            {
              
//                if(savemodel.ID == null)
//                {
//                    var model = new VoucherHistory
//                                    {
//                                                                            Code=savemodel.Code,    
//                                            Account=savemodel.Account,    
//                                            NickName=savemodel.NickName,    
//                                            RMB=savemodel.RMB,    
//                                            PayType=savemodel.PayType,    
//                                            FuFeiType=savemodel.FuFeiType,    
//                                            OpenMonth=savemodel.OpenMonth,    
//                                            CreateDate=savemodel.CreateDate,    
//                                            FinishDate=savemodel.FinishDate,    
//                                            State=savemodel.State,    
//                                            };
//                    _voucherhistoryTask.Add(model);
//                }
//                else
//                {
//                    var model = _voucherhistoryTask.GetById((int) savemodel.ID);

//                    if(model == null)
//                        return AlertMsg("参数错误", HttpContext.Request.UrlReferrer.PathAndQuery);

//                                                                model.Code=savemodel.Code;  
//                                                     model.Account=savemodel.Account;  
//                                                     model.NickName=savemodel.NickName;  
//                                                     model.RMB=savemodel.RMB;  
//                                                     model.PayType=savemodel.PayType;  
//                                                     model.FuFeiType=savemodel.FuFeiType;  
//                                                     model.OpenMonth=savemodel.OpenMonth;  
//                                                     model.CreateDate=savemodel.CreateDate;  
//                                                     model.FinishDate=savemodel.FinishDate;  
//                                                     model.State=savemodel.State;  
		                  

//                    _voucherhistoryTask.Update(model);
//                }
//                return AlertMsg("保存成功", HttpContext.Request.UrlReferrer.PathAndQuery);
                
//            }
                      
//            return View(savemodel);
//        }

     

//        #region 删除用户信息 Delete

//        [HttpPost]
//        public void Delete(int id)
//        {
//            _voucherhistoryTask.Delete(id);
//        }

//        #endregion
//    }
//}